package com.chaucer.demo.transmit;

/**
 * @Description TODO
 * @Author Chaucer
 * @Date 2021/9/3 11:01
 */
public class BusinessSourceThreadLocal {
    private static ThreadLocal<String> businessSourceThreadLocal = new InheritableThreadLocal<>();

    /**
     * constructor
     */
    private BusinessSourceThreadLocal() {}

    /**
     * 设置本地用户线程
     *
     * @param data 信息
     */
    public static void set(String data) {
        businessSourceThreadLocal.set(data);
    }

    /**
     * 获取当前线程数据
     *
     * @return AppUser
     */
    public static String get() {
        return businessSourceThreadLocal.get();
    }

    /**
     * clearThreadLocal
     */
    public static void clearThreadLocal() {
        businessSourceThreadLocal.remove();
    }

}